home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
COMAL
/
U-User Group
/
(k)u4.d64
/
val2.proc
< prev
next >
Wrap
Text File
|
2007-02-28
|
674b
|
33 lines
9000 // LIST "@0:VAL2.PROC"
9010 //
9020 // BY WILL BOW
9030 // C64 WEST USER GROUP
9040 // BOX 406
9050 // SANTA MONICA, CA 90406-0406
9060 //
9070 // USE THIS TO CONVERT A STRING
9080 // OF NUMBERS TO A REAL NUMBER.
9090 // WILL CONVERT FRACTIONS LIKE
9100 // "1234.94".
9110 //
9120 FUNC VAL(STR$) CLOSED
9130 REPLY:=0
9140 Z:="." IN STR$
9150 IF Z=0 THEN
9160 Y:=0
9170 ELSE
9180 Y:=LEN(STR$)-Z+1
9190 ENDIF
9200 FOR X:=1 TO LEN(STR$) DO
9210 IF STR$(X) IN "1234567890" THEN
9220 REPLY:=REPLY+(ORD(STR$(X))-48)*(10^(LEN(STR$)-X-Y))
9230 ELSE
9240 Y:=Y-1
9250 ENDIF
9260 ENDFOR X
9270 RETURN REPLY
9280 ENDFUNC VAL
9290 //
9300 // WRITTEN BY WILL BOW
9310 // BOX 406